const {MONGODB_URI} = require("../config");
const mongoose = require('mongoose');

(
    async () => {
    console.log("Db connectect starting ···")
    mongoose.set('strictQuery',true)
  try {
    const db = await mongoose.connect(MONGODB_URI,{useNewUrlParser:true});
    
    console.log("------------------------")
    console.log("数据库链接成功，当前操作数据库:",db.connection.name)
    console.log("------------------------")
  } catch (error) {
    console.log("------------------------")
    console.log("数据库链接失败:",error)
    console.log("------------------------")
  }
})();
